package eclant.ant.types;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.types.DataType;

public abstract class CustomDataType extends DataType
{
	private boolean hasAttributes = false;

	@Override
	protected BuildException circularReference()
	{
		return new BuildException("This data type contains a circular reference.", getLocation());
	}

	@Override
	protected BuildException noChildrenAllowed()
	{
		return new BuildException("You must not specify nested elements when using refid",
				getLocation());
	}

	@Override
	protected BuildException tooManyAttributes()
	{
		return new BuildException("You must not specify more than one attribute when using refid",
				getLocation());
	}

	protected boolean hasAttributes()
	{
		return hasAttributes;
	}

	protected void gotAttribute()
	{
		checkAttributesAllowed();
		hasAttributes = true;
	}

}
